package com.zjxmyq.authorization.service;

import com.zjxmyq.authorization.domain.Company;
import com.zjxmyq.authorization.mapper.CompanyMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CompanyService {
    @Resource
    CompanyMapper companyMapper;
    public String signCompany(Company company){
        int res = companyMapper.insert(company);
        if (res > 0){
            return "success";
        }else{
            return "fail";
        }
    }

    public String updateCompany(Company company){
        int res = companyMapper.updateById(company);
        if (res > 0){
            return "success";
        }else{
            return "fail";
        }
    }

    public String deleteCompany(int id){
        int res = companyMapper.deleteById(id);
        log.info("delete row {}:{}",id,res);
        if (res > 0){
            return "success";
        }else{
            return "fail";
        }
    }

}
